package com.linsen.erp.admin.provider.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

//户籍类型
@Getter
@AllArgsConstructor
public enum RegisterTypeEnum {
    COUNTY(1,"农村户口"),
    TOWN(2,"城镇户口"),
    OTHER(3,"其他"),
    ;

    @JsonValue
    private final Integer value;
    private final String desc;

    private static final Map<Integer, RegisterTypeEnum> VALUES = new HashMap<>();

    static {
        for (final RegisterTypeEnum registerTypeEnum : RegisterTypeEnum.values()) {
            RegisterTypeEnum.VALUES.put(registerTypeEnum.getValue(), registerTypeEnum);
        }
    }

    @JsonCreator
    public static RegisterTypeEnum getByValue(Integer value) {
        return RegisterTypeEnum.VALUES.get(value);
    }
}
